#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    ListNode* dfs(ListNode* head)
    {
        if (head == nullptr || head->next == nullptr)  return head;
        ListNode* headNext = head->next;
        ListNode* next = headNext->next;
        headNext->next = head;
        head->next = dfs(next);
        return headNext;

    }
    ListNode* swapPairs(ListNode* head) {
        ListNode* ret = dfs(head);
        return ret;
    }
};